﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Drive.LiveChat.Model
{
    public class ChatDbContext : DbContext
    {
        public ChatDbContext AsNoTracking()
        {
            ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
            return this;
        }
        public DbSet<ChatMessage> ChatMessages { get; set;  }
        public DbSet<Conversation> Conversations { get; set; }
        public DbSet<Visitor> Visitors { get; set; }

        public DbSet<VisitRecord> VisitRecords { get; set; }

        public DbSet<ChatAgent> ChatAgents { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseMySql(@"server=127.0.0.1;database=live-chat-db;uid=root;pwd=pwd123456");
            base.OnConfiguring(optionsBuilder);
        }
    }
}
